home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form DistortForm
- Caption = "Distort"
- ClientHeight = 2925
- ClientLeft = 2805
- ClientTop = 1395
- ClientWidth = 2910
- Height = 3615
- Left = 2745
- LinkTopic = "Form1"
- ScaleHeight = 2925
- ScaleWidth = 2910
- Top = 765
- Width = 3030
- Begin VB.PictureBox Canvas
- Height = 2895
- Left = 0
- ScaleHeight = 2835
- ScaleWidth = 2835
- TabIndex = 0
- Top = 0
- Width = 2895
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileExit
- Caption = "E&xit"
- End
- End
- Begin VB.Menu mnuTrans
- Caption = "&Transformation"
- Begin VB.Menu mnuTransChoice
- Caption = "&None"
- Checked = -1 'True
- Index = 0
- Shortcut = ^N
- End
- Begin VB.Menu mnuTransChoice
- Caption = "&Sines"
- Index = 1
- Shortcut = ^S
- End
- Begin VB.Menu mnuTransChoice
- Caption = "&Twist"
- Index = 2
- Shortcut = ^T
- End
- Begin VB.Menu mnuTransChoice
- Caption = "&Circle"
- Index = 3
- Shortcut = ^C
- End
- End
- Attribute VB_Name = "DistortForm"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Dim ThePicture As ObjPicture
- Dim Filename As String
- Dim xmid As Single
- Dim ymid As Single
- Dim wid As Single
- Private Sub canvas_Paint()
- If Not ThePicture Is Nothing Then _
- ThePicture.Draw canvas
- End Sub
- Private Sub Form_Load()
- LoadLines
- End Sub
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
- Sub LoadLines()
- Const gap = 250
- Dim poly As ObjPolygon
- Dim i As Integer
- Dim j As Integer
- Set ThePicture = New ObjPicture
- For i = 1 To 10
- ' Horizontal line.
- Set poly = New ObjPolygon
- ThePicture.Objects.Add poly
- poly.NumPoints = 10
- For j = 1 To 10
- poly.SetPoint j, j * gap, i * gap
- Next j
-
- ' Vertical line.
- Set poly = New ObjPolygon
- ThePicture.Objects.Add poly
- poly.NumPoints = 10
- For j = 1 To 10
- poly.SetPoint j, i * gap, j * gap
- Next j
- Next i
- xmid = 5.5 * gap
- ymid = xmid
- wid = 5 * gap
- End Sub
- Private Sub mnuTransChoice_Click(Index As Integer)
- Dim trans As Object
- Dim i As Integer
- ' Check the selected transformation.
- For i = 0 To 3
- mnuTransChoice(i).Checked = False
- Next i
- mnuTransChoice(Index).Checked = True
- ' Reload the data.
- LoadLines
- ' Load the correct transformation.
- Select Case Index
- Case 1 ' Sines.
- Set trans = New DistortSines
- trans.amplitude = 100
- trans.period = 2500
- Case 2 ' Twist.
- Set trans = New DistortTwist
- trans.cx = xmid
- trans.cy = ymid
- Case 3 ' Circle.
- Set trans = New DistortCircle
- trans.cx = xmid
- trans.cy = ymid
- trans.radius = wid * 2
- End Select
- ' If the transformation is not none, apply it.
- If Index > 0 Then ThePicture.Distort trans
- ' Redraw the picture.
- canvas.Refresh
- End Sub
-